package com.aote.entity.propertygather;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.w3c.dom.Element;

import com.browsesoft.ExtendElement;

/**
 * 基本属性收集器，从页面得到还有gather="gather"的元素，从原来的属性总得到值
 * 
 */
public class BasicPropertyGather implements PropertyGather {

	public Map gather(Element pageElem, Hashtable attrs) {
		Map result = new HashMap();
		List list = ExtendElement.findElements(pageElem, "gather", "gather");
		Iterator iter = list.iterator();
		while (iter.hasNext()) {
			Element elem = (Element) iter.next();
			String name = elem.getAttribute("name");
			String value = (String) attrs.get(name);
			if (value != null) {
				result.put(name, value);
			}
		}
		return result;
	}

}
